const index_test = 0,
  index_dev = 1,
  index_prod = 2;
const test = "test",
  dev = "dev",
  prod = "prod";
let env = [];
env[index_test] = test;
env[index_dev] = dev;
env[index_prod] = prod;

let obj = {
  serverPort: 60224,
  redisPrefix: "assessor:acd",
};

console.error(process.env.NODE_ENV);
let index = env.indexOf(process.env.NODE_ENV);
console.error("process.env.NODE_ENV index:", index);

switch (index) {
  case index_dev:
    Object.assign(obj, {
      host: "52.80.140.49",
      redisPort: 6379,
      redisAuth: "iloveTXtech2018",
    });
    break;

  case index_test:
    Object.assign(obj, {
      host: "r-uf64a76bcc26fd84pd.redis.rds.aliyuncs.com",
      redisPort: 6379,
      redisAuth: "iloveTXtech2018",
    });
    break;

  case index_prod:
    Object.assign(obj, {
      host: "172.16.0.83",
      redisPort: 6379,
      redisAuth: "iLvMs6902025",
    });
    break;

  default:
    console.error(" ERROR !!! NODE_ENV wrong:");
    break;
}

module.exports = obj;
